/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.wicket.data;

import com.sun.faces.util.CollectionsUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 *
 * @author Jeff
 */
public class MockDataBaseDAO {

    // Enforce singleton pattern
    private static MockDataBaseDAO mockDataBase;
    
    
    /*
     * Mock Numbers Table
     */
    
    // Represents the values for the mock numbers table
    private final List<String> numbers = new ArrayList<String>(1000);

    public List<String> getNumbers() {
        return numbers;
    }

    /*
     * Mock Contry Table
     */
    
    // Represents the Country record
    public class Country {

        private int id;
        private int numericalCode;
        private String countryOrAreaName;
        private String isoAlpha3Code;

        public String getCountryOrAreaName() {
            return countryOrAreaName;
        }

        public void setCountryOrAreaName(String countryOrAreaName) {
            this.countryOrAreaName = countryOrAreaName;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getIsoAlpha3Code() {
            return isoAlpha3Code;
        }

        public void setIsoAlpha3Code(String isoAlpha3Code) {
            this.isoAlpha3Code = isoAlpha3Code;
        }

        public int getNumericalCode() {
            return numericalCode;
        }

        public void setNumericalCode(int numericalCode) {
            this.numericalCode = numericalCode;
        }

        public Country(int numericalCode, String countryOrAreaName, String isoAlpha3Code) {
            this.id = 0;
            this.numericalCode = numericalCode;
            this.countryOrAreaName = countryOrAreaName;
            this.isoAlpha3Code = isoAlpha3Code;
        }
    }

    // Represents the Country table
    private final List<Country> countries = Arrays.asList(
            new Country(4, "Afghanistan", "AFG"),
            new Country(8, "Albania", "ALB"),
            new Country(12, "Algeria", "DZA"),
            new Country(16, "American Samoa", "ASM"),
            new Country(20, "Andorra", "AND"),
            new Country(24, "Angola", "AGO"),
            new Country(28, "Antigua and Barbuda", "ATG"),
            new Country(31, "Azerbaijan", "AZE"),
            new Country(32, "Argentina", "ARG"),
            new Country(36, "Australia", "AUS"),
            new Country(40, "Austria", "AUT"),
            new Country(44, "Bahamas", "BHS"),
            new Country(48, "Bahrain", "BHR"),
            new Country(50, "Bangladesh", "BGD"),
            new Country(51, "Armenia", "ARM"),
            new Country(52, "Barbados", "BRB"),
            new Country(56, "Belgium", "BEL"),
            new Country(60, "Bermuda", "BMU"),
            new Country(64, "Bhutan", "BTN"),
            new Country(68, "Bolivia (Plurinational State of)", "BOL"),
            new Country(70, "Bosnia and Herzegovina", "BIH"),
            new Country(72, "Botswana", "BWA"),
            new Country(76, "Brazil", "BRA"),
            new Country(84, "Belize", "BLZ"),
            new Country(90, "Solomon Islands", "SLB"),
            new Country(92, "British Virgin Islands", "VGB"),
            new Country(96, "Brunei Darussalam", "BRN"),
            new Country(100, "Bulgaria", "BGR"),
            new Country(104, "Myanmar", "MMR"),
            new Country(108, "Burundi", "BDI"),
            new Country(112, "Belarus", "BLR"),
            new Country(116, "Cambodia", "KHM"),
            new Country(120, "Cameroon", "CMR"),
            new Country(124, "Canada", "CAN"),
            new Country(132, "Cape Verde", "CPV"),
            new Country(136, "Cayman Islands", "CYM"),
            new Country(140, "Central African Republic", "CAF"),
            new Country(144, "Sri Lanka", "LKA"),
            new Country(148, "Chad", "TCD"),
            new Country(152, "Chile", "CHL"),
            new Country(156, "China", "CHN"),
            new Country(170, "Colombia", "COL"),
            new Country(174, "Comoros", "COM"),
            new Country(175, "Mayotte", "MYT"),
            new Country(178, "Congo", "COG"),
            new Country(180, "Democratic Republic of the Congo", "COD"),
            new Country(184, "Cook Islands", "COK"),
            new Country(188, "Costa Rica", "CRI"),
            new Country(191, "Croatia", "HRV"),
            new Country(192, "Cuba", "CUB"),
            new Country(196, "Cyprus", "CYP"),
            new Country(203, "Czech Republic", "CZE"),
            new Country(204, "Benin", "BEN"),
            new Country(208, "Denmark", "DNK"),
            new Country(212, "Dominica", "DMA"),
            new Country(214, "Dominican Republic", "DOM"),
            new Country(218, "Ecuador", "ECU"),
            new Country(222, "El Salvador", "SLV"),
            new Country(226, "Equatorial Guinea", "GNQ"),
            new Country(231, "Ethiopia", "ETH"),
            new Country(232, "Eritrea", "ERI"),
            new Country(233, "Estonia", "EST"),
            new Country(234, "Faeroe Islands", "FRO"),
            new Country(238, "Falkland Islands (Malvinas)", "FLK"),
            new Country(242, "Fiji", "FJI"),
            new Country(246, "Finland", "FIN"),
            new Country(248, "Åland Islands", "ALA"),
            new Country(250, "France", "FRA"),
            new Country(254, "French Guiana", "GUF"),
            new Country(258, "French Polynesia", "PYF"),
            new Country(262, "Djibouti", "DJI"),
            new Country(266, "Gabon", "GAB"),
            new Country(268, "Georgia", "GEO"),
            new Country(270, "Gambia", "GMB"),
            new Country(275, "Occupied Palestinian Territory", "PSE"),
            new Country(276, "Germany", "DEU"),
            new Country(288, "Ghana", "GHA"),
            new Country(292, "Gibraltar", "GIB"),
            new Country(296, "Kiribati", "KIR"),
            new Country(300, "Greece", "GRC"),
            new Country(304, "Greenland", "GRL"),
            new Country(308, "Grenada", "GRD"),
            new Country(312, "Guadeloupe", "GLP"),
            new Country(316, "Guam", "GUM"),
            new Country(320, "Guatemala", "GTM"),
            new Country(324, "Guinea", "GIN"),
            new Country(328, "Guyana", "GUY"),
            new Country(332, "Haiti", "HTI"),
            new Country(336, "Holy See", "VAT"),
            new Country(340, "Honduras", "HND"),
            new Country(344, "China, Hong Kong Special Administrative Region", "HKG"),
            new Country(348, "Hungary", "HUN"),
            new Country(352, "Iceland", "ISL"),
            new Country(356, "India", "IND"),
            new Country(360, "Indonesia", "IDN"),
            new Country(364, "Iran (Islamic Republic of)", "IRN"),
            new Country(368, "Iraq", "IRQ"),
            new Country(372, "Ireland", "IRL"),
            new Country(376, "Israel", "ISR"),
            new Country(380, "Italy", "ITA"),
            new Country(384, "Côte d'Ivoire", "CIV"),
            new Country(388, "Jamaica", "JAM"),
            new Country(392, "Japan", "JPN"),
            new Country(398, "Kazakhstan", "KAZ"),
            new Country(400, "Jordan", "JOR"),
            new Country(404, "Kenya", "KEN"),
            new Country(408, "Democratic People's Republic of Korea", "PRK"),
            new Country(410, "Republic of Korea", "KOR"),
            new Country(414, "Kuwait", "KWT"),
            new Country(417, "Kyrgyzstan", "KGZ"),
            new Country(418, "Lao People's Democratic Republic", "LAO"),
            new Country(422, "Lebanon", "LBN"),
            new Country(426, "Lesotho", "LSO"),
            new Country(428, "Latvia", "LVA"),
            new Country(430, "Liberia", "LBR"),
            new Country(434, "Libyan Arab Jamahiriya", "LBY"),
            new Country(438, "Liechtenstein", "LIE"),
            new Country(440, "Lithuania", "LTU"),
            new Country(442, "Luxembourg", "LUX"),
            new Country(446, "China, Macao Special Administrative Region", "MAC"),
            new Country(450, "Madagascar", "MDG"),
            new Country(454, "Malawi", "MWI"),
            new Country(458, "Malaysia", "MYS"),
            new Country(462, "Maldives", "MDV"),
            new Country(466, "Mali", "MLI"),
            new Country(470, "Malta", "MLT"),
            new Country(474, "Martinique", "MTQ"),
            new Country(478, "Mauritania", "MRT"),
            new Country(480, "Mauritius", "MUS"),
            new Country(484, "Mexico", "MEX"),
            new Country(492, "Monaco", "MCO"),
            new Country(496, "Mongolia", "MNG"),
            new Country(498, "Republic of Moldova", "MDA"),
            new Country(499, "Montenegro", "MNE"),
            new Country(500, "Montserrat", "MSR"),
            new Country(504, "Morocco", "MAR"),
            new Country(508, "Mozambique", "MOZ"),
            new Country(512, "Oman", "OMN"),
            new Country(516, "Namibia", "NAM"),
            new Country(520, "Nauru", "NRU"),
            new Country(524, "Nepal", "NPL"),
            new Country(528, "Netherlands", "NLD"),
            new Country(531, "Curaçao", "CUW"),
            new Country(533, "Aruba", "ABW"),
            new Country(534, "Sint Maarten (Dutch part)", "SXM"),
            new Country(535, "Bonaire, Saint Eustatius and Saba", "BES"),
            new Country(540, "New Caledonia", "NCL"),
            new Country(548, "Vanuatu", "VUT"),
            new Country(554, "New Zealand", "NZL"),
            new Country(558, "Nicaragua", "NIC"),
            new Country(562, "Niger", "NER"),
            new Country(566, "Nigeria", "NGA"),
            new Country(570, "Niue", "NIU"),
            new Country(574, "Norfolk Island", "NFK"),
            new Country(578, "Norway", "NOR"),
            new Country(580, "Northern Mariana Islands", "MNP"),
            new Country(583, "Micronesia (Federated States of)", "FSM"),
            new Country(584, "Marshall Islands", "MHL"),
            new Country(585, "Palau", "PLW"),
            new Country(586, "Pakistan", "PAK"),
            new Country(591, "Panama", "PAN"),
            new Country(598, "Papua New Guinea", "PNG"),
            new Country(600, "Paraguay", "PRY"),
            new Country(604, "Peru", "PER"),
            new Country(608, "Philippines", "PHL"),
            new Country(612, "Pitcairn", "PCN"),
            new Country(616, "Poland", "POL"),
            new Country(620, "Portugal", "PRT"),
            new Country(624, "Guinea-Bissau", "GNB"),
            new Country(626, "Timor-Leste", "TLS"),
            new Country(630, "Puerto Rico", "PRI"),
            new Country(634, "Qatar", "QAT"),
            new Country(638, "Réunion", "REU"),
            new Country(642, "Romania", "ROU"),
            new Country(643, "Russian Federation", "RUS"),
            new Country(646, "Rwanda", "RWA"),
            new Country(652, "Saint-Barthélemy", "BLM"),
            new Country(654, "Saint Helena", "SHN"),
            new Country(659, "Saint Kitts and Nevis", "KNA"),
            new Country(660, "Anguilla", "AIA"),
            new Country(662, "Saint Lucia", "LCA"),
            new Country(663, "Saint-Martin (French part)", "MAF"),
            new Country(666, "Saint Pierre and Miquelon", "SPM"),
            new Country(670, "Saint Vincent and the Grenadines", "VCT"),
            new Country(674, "San Marino", "SMR"),
            new Country(678, "Sao Tome and Principe", "STP"),
            new Country(682, "Saudi Arabia", "SAU"),
            new Country(686, "Senegal", "SEN"),
            new Country(688, "Serbia", "SRB"),
            new Country(690, "Seychelles", "SYC"),
            new Country(694, "Sierra Leone", "SLE"),
            new Country(702, "Singapore", "SGP"),
            new Country(703, "Slovakia", "SVK"),
            new Country(704, "Viet Nam", "VNM"),
            new Country(705, "Slovenia", "SVN"),
            new Country(706, "Somalia", "SOM"),
            new Country(710, "South Africa", "ZAF"),
            new Country(716, "Zimbabwe", "ZWE"),
            new Country(724, "Spain", "ESP"),
            new Country(732, "Western Sahara", "ESH"),
            new Country(736, "Sudan", "SDN"),
            new Country(740, "Suriname", "SUR"),
            new Country(744, "Svalbard and Jan Mayen Islands", "SJM"),
            new Country(748, "Swaziland", "SWZ"),
            new Country(752, "Sweden", "SWE"),
            new Country(756, "Switzerland", "CHE"),
            new Country(760, "Syrian Arab Republic", "SYR"),
            new Country(762, "Tajikistan", "TJK"),
            new Country(764, "Thailand", "THA"),
            new Country(768, "Togo", "TGO"),
            new Country(772, "Tokelau", "TKL"),
            new Country(776, "Tonga", "TON"),
            new Country(780, "Trinidad and Tobago", "TTO"),
            new Country(784, "United Arab Emirates", "ARE"),
            new Country(788, "Tunisia", "TUN"),
            new Country(792, "Turkey", "TUR"),
            new Country(795, "Turkmenistan", "TKM"),
            new Country(796, "Turks and Caicos Islands", "TCA"),
            new Country(798, "Tuvalu", "TUV"),
            new Country(800, "Uganda", "UGA"),
            new Country(804, "Ukraine", "UKR"),
            new Country(807, "The former Yugoslav Republic of Macedonia", "MKD"),
            new Country(818, "Egypt", "EGY"),
            new Country(826, "United Kingdom of Great Britain and Northern Ireland", "GBR"),
            new Country(830, "Channel Islands", "dum"),
            new Country(831, "Guernsey", "GGY"),
            new Country(832, "Jersey", "JEY"),
            new Country(833, "Isle of Man", "IMN"),
            new Country(834, "United Republic of Tanzania", "TZA"),
            new Country(840, "United States of America", "USA"),
            new Country(850, "United States Virgin Islands", "VIR"),
            new Country(854, "Burkina Faso", "BFA"),
            new Country(858, "Uruguay", "URY"),
            new Country(860, "Uzbekistan", "UZB"),
            new Country(862, "Venezuela (Bolivarian Republic of)", "VEN"),
            new Country(876, "Wallis and Futuna Islands", "WLF"),
            new Country(882, "Samoa", "WSM"),
            new Country(887, "Yemen", "YEM"),
            new Country(894, "Zambia", "ZMB"));

    public List<Country> getCountries() {
        return countries;
    }
    
    /**
     * Private constructor enforces creation through getMockDataBaseDAO
     * factory method
     */
    private MockDataBaseDAO() {
        // Populates the mock Numbers table with 1000 numbers as Strings
        for (int i = 0; i < 1000; i++) {
            numbers.add(Integer.toString(i));
        }

        // Sort the mock Country table by countryOrAreaName
        Collections.sort(countries, new Comparator<Country>(){

            @Override
            public int compare(Country o1, Country o2) {
                return o1.getCountryOrAreaName().compareTo(o2.getCountryOrAreaName());
            }
            
        });
        
        // generate the ids for the mock Country table result set
        for(int i = 0; i < countries.size(); i++){
            countries.get(i).id = i;
        }

    }

    /**
     * Factory method to create singleton
     * @return MockDataBaseDAO
     */
    public static MockDataBaseDAO getMockDataBaseDAO() {
        if (mockDataBase == null) {
            mockDataBase = new MockDataBaseDAO();
        }
        return mockDataBase;
    }
}
